library(shiny)

# Load precomputed data
sct_data <- readRDS(file = "data/rds/sct_data.rds")
choropleth_data <- readRDS(file = "data/rds/choropleth_data.rds")
parallelcoordinates_data <- readRDS(file = "data/rds/parallelcoordinates_data.rds")
bar_data  <- readRDS(file = "data/rds/bar_data.rds")
radar_data  <- readRDS(file = "data/rds/radar_data.rds")
treemap_data <- readRDS(file = "data/rds/treemap_data.rds")
tree_data <- readRDS(file = "data/rds/tree_data.rds")

server <- function(input, output, session) {

    observe({

        session$sendCustomMessage(type="scatterplot_values", message = sct_data)

    })

    observe({

        session$sendCustomMessage(type="dendrogram_values",
                                  message = list(tree_data,
                                                 bar_data,
                                                 radar_data))

    })

    observe({

        session$sendCustomMessage(type="treemap2_values", message = treemap_data)

    })


    observe({

        session$sendCustomMessage(type="choropleth_values", message = choropleth_data)

    })

    observe({

        session$sendCustomMessage(type="parallelcoordinates_values", message = parallelcoordinates_data)

    })

}
